# 用类封装一个MyMath类, 实现加, 减, 乘, 除, 幂, 开方
class MyMath(object):
    def add_(self, a, b):
        return a+b
    def less(self, a, b):
        return a - b
    def pow_(self, a, b):
        return a ** b
    def exce(self, a, b):
        return a / b
if __name__ == '__main__':
    a = int(input("请输入第一个整数："))
    b = int(input("请输入第二个整数："))
    p = MyMath()
    print(p.add_(a, b))
    print(p.less(a, b))
    print(p.pow_(a, b))
    print(p.exce(a, b))


# 抽象出一个类
class Animal(object):
    def __init__(self, value):
        self.name = value
        self.age = 10

cat = Animal('Ivan')
dog = Animal("Mary")

print(cat.age, cat.name, dog.age, dog.name)


# 创建多个继承作业2父类的子类
class Dog(Animal):
    print("the dog is running")

class Cat(Animal):
    print("the cat is watching you")

d = Dog("狗")
print(d.name)
print(d.age)

c = Cat("猫")
print(c.name)
print(c.age)